package com.cuit.mimall.controller.backend;

import com.cuit.mimall.common.R;
import com.cuit.mimall.service.IOrderService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author TeaWu
 * @folder 后台/订单
 */
@RestController("backendOrderController")
@RequestMapping("/api/v1/backend/order")
public class OrderController {
    private final IOrderService orderService;

    public OrderController(IOrderService orderService) {
        this.orderService = orderService;
    }


    /**
     * 分页按条件查询订单项列表
     *
     * @param pageNumber  页码
     * @param pageSize    每页数量
     * @param orderNo     订单号
     * @param orderStatus 订单状态
     */
    @GetMapping("/getOrderItemByCondition")
    public R<?> getOrderItemByCondition(@RequestParam(defaultValue = "1") Integer pageNumber,
                                        @RequestParam(defaultValue = "10") Integer pageSize,
                                        @RequestParam(required = false) String orderNo,
                                        @RequestParam(required = false ) Integer orderStatus) {
        return orderService.getOrderItemByCondition(pageNumber, pageSize, orderNo, orderStatus);
    }
}
